#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include "string.h"
using namespace std;


void test1()
{
	/*my_string::string s1 = "abc";
	std::cout << s1.c_str() << std::endl;
	my_string::string s2(s1);
	std::cout << s2.c_str() << std::endl;

	cout << s2.size() << " " << s1.capacity() << endl;*/



	my_string::string s1 = "12345";
	for (int i = 0; i < s1.size(); i++)
	{
		cout << s1[i];

	}
	cout << endl;

	my_string::string::iterator it = s1.begin();
	while (it!=s1.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;

	for (auto e : s1)
	{
		cout << e;
		e++;
	}
	cout << endl;


	const my_string::string s2 = "12345";
	for (int i = 0; i < s2.size(); i++)
	{
		cout << s2[i];

	}
	cout << endl;
	auto rit = s2.begin();
	while (rit != s2.end())
	{
		cout << *rit << " ";
		rit++;
	}
	cout << endl;

}

void test2()
{
	my_string::string s1 = "12345";
	my_string::string s2 = "12345";

	/*s1.reserve(20);
	cout << s1.capacity() << endl;*/

	/*s1.append(s2);
	cout << s1.c_str() << endl;*/
	//cout << s1.c_str() << endl;
	//s1.append("zxcv");
	//cout << s1;

	s1 += s2;
	cout << s1.c_str() << endl;
	s1 += 'x';
	cout << s1.c_str() << endl;
	s1 += "zsa";
	cout << s1.c_str() << endl;

}


void test3()
{
	my_string::string s1 = "012345";
	my_string::string s2 = "xxxx";

	/*s1.insert(0,"xx");*/
	//s1.insert(5, s2);
	s1.erase(6);
	cout << s1.c_str() << endl;
}

void test4()
{
	my_string::string s1 = "012x345";
	cout << s1.find("34");
}


void test5()
{
	my_string::string url = "https://legacy.cplusplus.com/reference/string/string/find/";
	size_t pos1 = url.find("://");
	my_string::string protocol;
	my_string::string domain;
	my_string::string uri;
	if (pos1 != string::npos)
	{
		protocol = url.substr(0, pos1);
	}
	cout << protocol.c_str() << endl;


	size_t pos2 = url.find('/', pos1 + 3);
	if (pos2 != string::npos)
	{
		domain = url.substr(pos1 + 3, pos2 - (pos1 + 3));
		uri = url.substr(pos2 + 1);
	}
	cout << domain.c_str() << endl;
	cout << uri.c_str() << endl;
}


void test6()
{
	my_string::string s1;
	my_string::string s2;
	cin >> s1;
	cout << s1;
	/*cin >> s1;
	cout << s1;*/
}


void test7()
{
	my_string::string s1("hellocccc");
	my_string::string s2("hello");
	cout << (s1 == s2) << endl;
}
void test8()
{
	my_string::string s1("hello");
	my_string::string s2("xxxxx");
	s2 = s1;
	cout << s2 << endl;

	/*my_string::string s1("hellocxxxxx");
	s1.erase(2, 3);
	cout << s1.c_str() << endl;*/




}

int main()
{
	//test8();
	my_string::string s1("hello");
	my_string::string s(s1);
	my_string::string s2("xxxxxjj");

	s = s2;	
	return 0;
}